@extends('admin.public')

@section('content')
    {{--留言/评价 统计--}}
    <div class="col-md-12">
        <footer class="bg-success text-center m-b">
            <div class="row">
                <div class="col-xs-4">
                    <div class="padder-v">
                        <span class="m-b-xs h3 block text-white">{{ count($messages) }}</span>
                        <small class="text-muted"><i class="icon-social-dropbox ico"></i> 留言/评论</small>
                    </div>
                </div>
                <div class="col-xs-4 dk">
                    <div class="padder-v">
                        @php
                            $noread = array_count_values(array_column($messages,'status'));
                        @endphp
                        <span class="m-b-xs h3 block text-white">{{ $noread[1] or 0 }}</span>
                        <small class="text-muted"><i class="icon-eyeglasses ico"></i> 未读信息</small>
                    </div>
                </div>
                <div class="col-xs-4">
                    <div class="padder-v">
                        <span class="m-b-xs h3 block text-white">{{ $messageLinkInfoNum }}</span>
                        <small class="text-muted"><i class="icon-link ico"></i> 信息相关</small>
                    </div>
                </div>
            </div>
        </footer>
    </div>

    <div class="col-lg-12">
        <div class="panel-group m-b" id="accordion2">
            @if(!empty($messages))
                @foreach($messages as $k => $message)
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2"
                               href="#collapse{{ $k }}">
                                {{--@if(!empty($message['status'])&&(bool)$message['status'])--}}
                                <span class="text-info m-r">
                                    {{ $message['created_at'] }}
                                    @if(!empty($message['info']))
                                        <i class="icon-link m-l ico text-success" title="信息相关留言/评价"></i>
                                    @endif
                                </span>
                                {{--@else--}}
                                {{--<span class="text-danger m-r">状态 : {{ !empty($message['status'])&&(bool)$message['status']?'未读':'已读' }}</span>--}}
                                {{--@endif--}}
                            </a>
                            <a href="{{ route('admin.message.message') }}?del={{ $message['id'] }}"
                               class="btn btn-xs btn-default pull-right">删除</a>
                            @if(!empty($message['status'])&&(bool)$message['status'])
                                <a href="{{ route('admin.message.message') }}?status={{ $message['id'] }}"
                                   class="btn btn-xs btn-default pull-right m-r">设为已读</a>
                            @else
                                <a href="{{ route('admin.message.message') }}?status={{ $message['id'] }}"
                                   class="btn btn-xs btn-default pull-right m-r">设为未读</a>
                            @endif
                        </div>
                        <div id="collapse{{ $k }}" class="panel-collaps collapse {{ $k==0 ? 'in' : '' }}">
                            <div class="panel-body text-sm" style="line-height: 24px;">
                                @if($message['info'])
                                    <a class="btn btn-xs btn-success m-b"
                                       href="{{ route('info',[$message['info']['path'],$message['info']['id']]) }}">
                                        <i class="icon-link ico"></i>&nbsp;&nbsp;&nbsp;{{ $message['info']['name'] }}
                                    </a>
                                    <br>
                                @endif
                                留言时间:{{ $message['updated_at'] }}<br>
                                {!! implode('<br>',$message['data']) !!}
                            </div>
                        </div>
                    </div>
                @endforeach
            @else
                <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">×</button>
                    <i class="fa fa-ban-circle"></i>
                    暂时没有人留言!
                </div>
            @endif
        </div>
    </div>
@endsection

@section('css')
@endsection

@section('js')
@endsection